package com.qys.livesMall.open.service.impl;

import com.qys.livesMall.common.result.R;
import com.qys.livesMall.open.dao.H2MailConfigDao;
import com.qys.livesMall.open.modal.dto.mail.EditMailConfig;
import com.qys.livesMall.open.modal.entity.H2MailConfig;
import com.qys.livesMall.open.service.H2MailConfigService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wzy
 * @since 2023-04-23
 */
@Service
public class H2MailConfigServiceImpl  implements H2MailConfigService {

    @Autowired
    private H2MailConfigDao h2MailConfigDao;
    @Override
    public H2MailConfig getConfig() {
        return h2MailConfigDao.getConfig();
    }

    @Override
    public R edit(EditMailConfig editMailConfig) {
        H2MailConfig config=getConfig();
        BeanUtils.copyProperties(editMailConfig,config);
        h2MailConfigDao.updateById(config);
        return R.ok();
    }
}
